1. Technical Field
This disclosure generally relates to computer database systems, and more specifically relates to a query governor for a database system that intelligently sets tailored thresholds for governing a query accessing a computer database.
2. Background Art
A computer database is a collection of computer data stored within a computer system. To be useful, the data stored in databases must be able to be efficiently retrieved. The most common way to retrieve data from a database is to generate a database query. A database query is an expression that is evaluated by a database manager. One popular way to define a query uses Structured Query Language (SQL). SQL defines a syntax for generating and processing queries that is independent of the actual structure and format of the database. When the database receives a query request, it produces an access plan to execute the query in the database. A tool known as a query optimizer evaluates expressions in a query and optimizes the query and generates the access plan to access the database.
The data in the database is typically accessed through the use of queries by computer users either directly or through an applications. Query governors (QG) are employed with the computer database system to insure efficient use of the database by various users and reduce the impact of resource intensive queries on other users. The query governor compares a query's use of resources with a threshold to determine if the query should be allowed to execute. For example, the query governor compares a time estimate for a query to execute with some configured threshold, and stops queries which are estimated to take longer than the threshold. The query governor may use other thresholds such as temporary storage use or central processing unit (CPU) cycles in the same manner. Query governor thresholds are usually put in place to guard against inexperienced users writing queries which take high amounts of system resources on production machines. This inexperience leads to poorly constructed queries which may not be precisely what the user intends or may require excessive resources to get the needed data from the database. When a query is stopped by the query governor, the user may be questioned whether to proceed with the query with a prompt such as: “Did you really mean to run a query which takes N seconds?” The user can continue or kill the stopped query. Queries which are allowed to continue, and still take too long may have to be manually killed by the user or a system administrator. Thus, system administrators impose a query governor on the users to prevent large and meaningless queries from overtaking the computers and/or networks. However, more experienced users may have legitimate complex queries which will take a long time to run, but are very important to the business to run. Frustration will occur if the query governor frequently stops these legitimate queries from running